package com.cm.figure.controller.user.register;

import com.cm.figure.model.User;
import com.cm.figure.service.userService.RegisterUserService;
import com.cm.figure.utility.BuildData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


/**
 * ClassName:RegisterUser
 * Package:com.cm.figure.controller.user.register
 * Description:
 *
 * @Date:2021/8/14 14:29
 * @com.chuangmei
 */
@Controller
@RequestMapping("/api/private/figure/")
public class RegisterUser {

    @Autowired
    private RegisterUserService registerUserService;

    @PostMapping("register")
    @ResponseBody
    public Object register(@RequestBody User user) {

        // 注册
        User responseUser = registerUserService.registerUser(user);

        if (null == responseUser) {
            return BuildData.buildData(null,"注册用户失败 , 无法获取参数信息!",201);
        }else {
            return BuildData.buildData(responseUser,"注册用户成功!",200);
        }
    }

}
